<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="<%=path%>/js/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/js/themes/icon.css">
<script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.easyui.min.js"charset="utf-8"></script>
<script type="text/javascript" src="<%=path%>/js/locale/easyui-lang-zh_CN.js"charset="utf-8"></script>
<script type="text/javascript">
	
	$(function(){
		$(".easyui-linkbutton").click(function(){
	
		$("#hidettt").css("display","block");
		})
	})
	
		$(function(){
			
			$('#tt').datagrid({
				width:770,
				height:350,
				url:'<%=path%>/main/get/pros2',
				queryParams : {
      				 "cropid":<%=session.getAttribute("cropid")%>,
      				 "cretype":'0'
      			    },
				singleSelect:true,
				rownumbers:true,
			    selectOnCheck: true,
			    checkOnSelect: true,
			    fit:false, 
			    pagination : true,
		        loadMsg: '数据加载中...',
			    mode : 'remote',
			    delay : 500,
			    rownumbers:true,
			    checkbox:true,
				columns:[[
				{field:'flag',title:'选择标志',width:80,checkbox:true},
				/* {field:'credencetype',title:'凭证类别',width:100, editor:{type:'text', options:{required: true }}}, */
				/* {field:'credenceP',title:'单据类型',width:145,editor:{type:'text', options:{required: true }}}, */
				{field:'serialno',title:'流水号',width:145,editor:{type:'text', options:{required: true }}},
				{field:'date',title:'日期',width:145,editor:{type:'text', options:{required: true }}},
				{field:'id',title:'客户编码',width:145,editor:{type:'text', options:{required: true }}},
				{field:'customer',title:'客户',width:145,editor:{type:'text', options:{required: true }}},
			 /* 	{field:'credenceMc',title:'借方金额',width:140,editor:{type:'text', options:{required: true }}},
				{field:'credenceMd',title:'贷方金额',width:140,editor:{type:'text', options:{required: true }}},  */
				{field:'',tite:'',width:120,align:'center',
	                formatter:function(value,row,index){
	                         var save='<a id="btn" href="#" class="easyui-linkbutton" onclick="updateRecord()">生成凭证</a>';
	                    	/*  var s = '<a href="#" onclick="editrowb(this)">编辑</a> ';
		                     var c = '<a href="#" onclick="cancelrowb(this)">取消</a>';
		                     var e = '<a href="#" onclick="saverowb(this)">保存</a> '; */
	                         return save;
	                  
	                } 
	            }
				 ]],
			});
			
			var pager=$('#tt').datagrid('getPager');
		    pager.pagination({
			        pageSize:10,
			        pageNumber:1,
			        pageList :[10,20,30],// 可以设置每页记录条数的列表
			        beforePageText: '第',//页数文本框前显示的汉字  
		            afterPageText: '页    共 {pages} 页',  
		            displayMsg: '共 {total} 条记录'
		      });
			
	});
		function updateRecord(num) { 
			
			$("#hidettt").css("display","block");
			
		}
</script>

<title>Insert title here</title>
<style>
	#d1{
		margin-top: 95px;
		text-align:center;
	}
#d2{
	margin-top: 40px;
}
#d2 table{border-right:1px solid black;border-bottom:1px solid black;} 
#d2 table td{border-left:1px solid black;border-top:1px solid black;width: 100px;
  		  height: 28px;text-align: center;} 
#d3{
	width: 770px;
	margin: 45px auto;
}
#d4{
	margin-left: 1274px;
	margin-top: 45px;
}

#s1{
	margin-left: 1486px;
}
</style>
<script type="text/javascript">

var num="";
	function updateRecord(){
		      var rows=[];
		      rows = $('#tt').datagrid('getChecked');
		     
		      isno=rows[0].serialno;
		      console.log(isno);
	          window.location.href="pzhenginfo6.jsp?lsh="+isno;

			 
 }


</script>

</head>

<body>
	

    	<div id="d1"><h2>生成凭证</h2></div>
       <div id="d3">


				<table id="tt">
				</table>
		</div>

</div> 
</body>
</html>